// 在 global-store.js 或类似文件中
import { defineStore } from 'pinia'

export const useGlobalStore = defineStore('global', {
  state: () => {
    return {
      isSidebarMinimized: false,
      isSidebarExpanded: true, // 新增一个state属性来控制侧边栏是否展开
    }
  },

  actions: {
    toggleSidebar() {
      this.isSidebarMinimized = !this.isSidebarMinimized
    },
    setSidebarExpanded(expanded) {
      this.isSidebarExpanded = expanded
    },
  },

  persist: {
    afterRestore: (ctx) => {
      // console.log(`刚刚恢复完 '${ctx.store.$id}'`)
    },
  },
})
